package com.kingdee.eas.xr.helper;

/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.


import com.kingdee.bos.ctrl.kdf.table.ICell;
import com.kingdee.bos.ctrl.kdf.table.IColumn;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTDefaultCellEditor;
import com.kingdee.bos.ctrl.kdf.table.KDTMenuManager;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectBlock;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectManager;
import com.kingdee.bos.ctrl.kdf.table.KDTSortManager;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.ctrl.kdf.table.foot.KDTFootManager;
import com.kingdee.bos.ctrl.kdf.table.util.KDTableUtil;
import com.kingdee.bos.ctrl.kdf.util.editor.ICellEditor;
import com.kingdee.bos.ctrl.kdf.util.style.StyleAttributes;
import com.kingdee.bos.ctrl.kdf.util.style.Styles;
import com.kingdee.bos.ctrl.swing.KDFormattedTextField;
import com.kingdee.bos.ctrl.swing.KDPopupMenu;
import com.kingdee.bos.ctrl.swing.KDSeparator;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.ItemAction;
import com.kingdee.eas.framework.client.CoreUI;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;
import com.kingdee.eas.util.client.MsgBox;
import com.kingdee.util.Assert;
import com.kingdee.util.StringUtils;
import java.io.PrintStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.JMenuItem;
import org.apache.commons.collections.MapUtils;

// Referenced classes of package com.kingdee.eas.ec.common.client:
//            EcZeroBaseRender, EcRenderUtil, EcEditorUtil, EcClientVerifyHelper, 
//            TableHelper, EcBaseRender

public class EcTableHelper
{

    public EcTableHelper()
    {
    }

    public static void setMerge(KDTable table, String columnNames[], boolean isMerge)
    {
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
            table.getColumn(columnNames[i]).setMergeable(isMerge);

    }

    public static void setLocked(KDTable table, String columnNames[], boolean isLock)
    {
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
            table.getColumn(columnNames[i]).getStyleAttributes().setLocked(isLock);

    }

    public static void setHided(KDTable table, String columnNames[], boolean isHide)
    {
        IColumn column = null;
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
        {
            column = table.getColumn(columnNames[i]);
            if(null != column)
                column.getStyleAttributes().setHided(isHide);
        }

    }

    public static void setEditor(KDTable table, String columnName, ICellEditor editor)
    {
        IColumn column = table.getColumn(columnName);
        if(null != column)
            column.setEditor(editor);
    }

    public static void setEditor(KDTable table, String columnNames[], ICellEditor editor)
    {
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
            setEditor(table, columnNames[i], editor);

    }

    public static void setEditor(KDTable table, String columnNames[], ICellEditor editors[])
    {
        int columnNamesLen = columnNames.length;
        int editorsLen = columnNames.length;
        String msg = (new StringBuilder()).append("\u5217\u540D\u957F\u5EA6\u4E3A").append(columnNamesLen).append("\uFF0C\u7F16\u8F91\u5668\u7684\u957F\u5EA6\u4E3A").append(editorsLen).append("\uFF0C\u4E0D\u76F8\u7B49").toString();
        Assert.that(columnNamesLen == editorsLen, msg);
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
            setEditor(table, columnNames[i], editors[i]);

    }

    public static void formatTable(KDTable table, String columnName, String format)
    {
        table.getColumn(columnName).getStyleAttributes().setNumberFormat(format);
    }

    public static void formatTableDate(KDTable table, String columnName)
    {
        if(table.getColumn(columnName) != null)
            formatTable(table, columnName, "yyyy-MM-dd");
    }

    public static void formatTableDate(KDTable table, String columnNames[])
    {
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
            formatTableDate(table, columnNames[i]);

    }

    public static void formatTableDate(KDTable table, List columnNameList)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatTableDate(table, columnNames);
        }
    }

    public static void formatTableDateTime(KDTable table, String columnName)
    {
        formatTable(table, columnName, "yyyy-MM-dd HH:mm:ss");
    }

    /**
     * @deprecated Method formatTableNumber is deprecated
     */

    public static void formatTableNumber(KDTable table, String columnName, String strDataFormat, int scale)
    {
        formatTableNumber2(table, columnName, scale);
    }

    public static void formatTableNumber(KDTable table, String columnName, int pre)
    {
        String dataFormat = EcRenderUtil.getDecimalFormat(pre);
        formatTableNumber(table, columnName, dataFormat, pre);
    }

    public static void formatTableNumber(KDTable table, String columnNames[], int pre)
    {
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
            if(table.getColumn(columnNames[i]) != null)
                formatTableNumber(table, columnNames[i], pre);

    }

    public static void formatTableNumber(KDTable table, List columnNameList, int pre)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatTableNumber(table, columnNames, pre);
        }
    }

    /**
     * @deprecated Method formatTableNumber is deprecated
     */

    public static void formatTableNumber(KDTable table, String columnNames[], int scale, int disScale)
    {
        formatTableNumber2(table, columnNames, scale);
    }

    public static void formatTableNumber(KDTable table, List columnNameList, int scale, int disScale)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatTableNumber(table, columnNames, scale, disScale);
        }
    }

    /**
     * @deprecated Method formatTableNumber is deprecated
     */

    public static void formatTableNumber(KDTable table, String columnName, int scale, int disScale)
    {
        formatTableNumber2(table, columnName, scale);
    }

    /**
     * @deprecated Method formatTableNumber is deprecated
     */

    public static void formatTableNumber(KDTable table, String columnName, int scale, int disScale, boolean isShowZero)
    {
        formatTableNumber2(table, columnName, scale, isShowZero);
    }

    /**
     * @deprecated Method formatFootNumber is deprecated
     */

    public static void formatFootNumber(KDTable table, String columnNames[], int scale, int disScale)
    {
        formatFootNumber2(table, columnNames, scale);
    }

    public static void formatFootNumber(KDTable table, List columnNameList, int scale, int disScale)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatFootNumber(table, columnNames, scale, disScale);
        }
    }

    /**
     * @deprecated Method formatFootNumber is deprecated
     */

    public static void formatFootNumber(KDTable table, String columnName, int scale, int disScale)
    {
        formatFootNumber2(table, columnName, scale);
    }

    /**
     * @deprecated Method setFootEditor is deprecated
     */

    public static void setFootEditor(KDTable table, String columnNames[], int scale)
    {
        setFootEditor2(table, columnNames, scale);
    }

    public static void setFootEditor(KDTable table, List columnNameList, int scale)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            setFootEditor(table, columnNames, scale);
        }
    }

    public static void setFootEditor(KDTable table, String columnName, int scale)
    {
        setFootEditor2(table, columnName, scale);
    }

    /**
     * @deprecated Method formatCellNumber is deprecated
     */

    public static void formatCellNumber(IRow irow, String as[], int i, int j)
    {
    }

    /**
     * @deprecated Method formatCellNumber is deprecated
     */

    public static void formatCellNumber(IRow row, List columnNameList, int scale, int disScale)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatCellNumber(row, columnNames, scale, disScale);
        }
    }

    /**
     * @deprecated Method formatCellNumber is deprecated
     */

    public static void formatCellNumber(IRow row, String columnName, int scale, int disScale)
    {
        formatCellNumber(row, columnName, scale, disScale, false);
    }

    /**
     * @deprecated Method formatCellNumber is deprecated
     */

    private static void formatCellNumber(IRow irow, String s, int i, int j, boolean flag)
    {
    }

    /**
     * @deprecated Method formatTableNumber2 is deprecated
     */

    public static void formatTableNumber2(KDTable table, String columnName, String strDataFormat, int scale)
    {
        formatTableNumber2(table, columnName, strDataFormat, scale, false);
    }

    /**
     * @deprecated Method formatTableNumber2 is deprecated
     */

    public static void formatTableNumber2(KDTable table, String columnName, String strDataFormat, int scale, boolean isShowZero)
    {
        if("notPasskQty".equals(columnName))
            System.out.println("");
        if(table.getColumn(columnName) != null)
        {
            if(strDataFormat == null)
                strDataFormat = EcRenderUtil.getDecimalFormat2(scale);
            StyleAttributes sa = table.getColumn(columnName).getStyleAttributes();
            sa.setNumberFormat(strDataFormat);
            sa.setHorizontalAlign(com.kingdee.bos.ctrl.kdf.util.style.Styles.HorizontalAlignment.RIGHT);
        }
    }

    public static void formatTableNumber2(KDTable table, String columnName, int pre)
    {
        boolean isShowZero = false;
        if(table != null && !StringUtils.isEmpty(columnName))
        {
            IColumn column = table.getColumn(columnName);
            if(column != null)
            {
                com.kingdee.bos.ctrl.kdf.util.render.IBasicRender basicRender = column.getRenderer();
                if(basicRender != null && (basicRender instanceof EcZeroBaseRender))
                    isShowZero = ((EcZeroBaseRender)basicRender).isShowZero();
            }
        }
        formatTableNumber2(table, columnName, pre, isShowZero);
    }

    public static void formatTableNumber2(KDTable table, String columnName, int pre, boolean isShowZero)
    {
        String dataFormat = EcRenderUtil.getDecimalFormat2(pre);
        formatTableNumber2(table, columnName, dataFormat, pre, isShowZero);
        table.putUserProperty("INIT_USERPROPERTIES", Boolean.TRUE);
        Map scaleMap = (Map)table.getUserProperty("TABLE_SCALE_MAP");
        if(null == scaleMap)
        {
            scaleMap = new HashMap();
            table.putUserProperty("TABLE_SCALE_MAP", scaleMap);
        }
        Map columnMap = new HashMap();
        columnMap.put("SCALE", new Integer(pre));
        columnMap.put("DISSCALE", new Integer(pre));
        scaleMap.put(columnName, columnMap);
    }

    public static void formatTableNumber2(KDTable table, String columnNames[], int pre)
    {
        int i = 0;
        for(int length = columnNames.length; i < length; i++)
            if(table.getColumn(columnNames[i]) != null)
                formatTableNumber2(table, columnNames[i], pre);

    }

    public static void formatTableNumber2(KDTable table, List columnNameList, int pre)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatTableNumber2(table, columnNames, pre);
        }
    }

    public static void formatFootNumber2(KDTable table, String columnNames[], int scale)
    {
        if(isNotEmpty(table) && EcArrayUtil.isNotEmpty(columnNames))
        {
            int length = columnNames.length;
            IRow row = null;
            String columnName = null;
            KDTFootManager footManager = table.getFootManager();
            if(null != footManager)
            {
                int k = 0;
                do
                {
                    try
                    {
                        row = footManager.getFootRow(k);
                    }
                    catch(Exception e)
                    {
                        break;
                    }
                    if(null == row)
                        break;
                    for(int i = 0; i < length; i++)
                    {
                        columnName = columnNames[i];
                        setScale(row, columnName, scale);
                        formatCellNumber2(row, columnName, scale);
                    }

                    k++;
                } while(true);
            }
        }
    }

    public static void formatFootNumber2(KDTable table, List columnNameList, int scale)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatFootNumber2(table, columnNames, scale);
        }
    }

    public static void formatFootNumber2(KDTable table, String columnName, int scale)
    {
        if(null != table.getColumn(columnName))
        {
            KDTFootManager footManager = table.getFootManager();
            if(null != footManager)
            {
                IRow row = null;
                int i = 0;
                do
                {
                    try
                    {
                        row = footManager.getFootRow(i);
                    }
                    catch(Exception e)
                    {
                        break;
                    }
                    if(null == row)
                        break;
                    setScale(row, columnName, scale);
                    formatCellNumber2(row, columnName, scale);
                    i++;
                } while(true);
            }
        }
    }

    public static void setFootEditor2(KDTable table, String columnNames[], int scale)
    {
        if(isNotEmpty(table) && EcArrayUtil.isNotEmpty(columnNames))
        {
            int length = columnNames.length;
            IRow row = null;
            String columnName = null;
            KDTFootManager footManager = table.getFootManager();
            if(null != footManager)
            {
                KDFormattedTextField txtNumber = new KDFormattedTextField();
                EcEditorUtil.setFormattedTextField(txtNumber, scale);
                KDTDefaultCellEditor numberEditor = new KDTDefaultCellEditor(txtNumber);
                numberEditor.setClickCountToStart(1);
                String colFormat = EcRenderUtil.getDecimalFormat2(scale);
                int k = 0;
                do
                {
                    try
                    {
                        row = footManager.getFootRow(k);
                    }
                    catch(Exception e)
                    {
                        break;
                    }
                    if(null == row)
                        break;
                    for(int i = 0; i < length; i++)
                    {
                        columnName = columnNames[i];
                        ICell cell = row.getCell(columnName);
                        if(null != cell)
                        {
                            cell.getStyleAttributes().setNumberFormat(colFormat);
                            cell.setEditor(numberEditor);
                            setScale(row, columnName, scale);
                            BigDecimal value = EcHelper.toBigDecimal(cell.getValue());
                            cell.setValue(value);
                        }
                    }

                    k++;
                } while(true);
            }
        }
    }

    public static void setFootEditor2(KDTable table, List columnNameList, int scale)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            setFootEditor2(table, columnNames, scale);
        }
    }

    public static void setFootEditor2(KDTable table, String columnName, int scale)
    {
        if(null != table.getColumn(columnName))
        {
            KDTFootManager footManager = table.getFootManager();
            if(null != footManager)
            {
                KDFormattedTextField txtNumber = new KDFormattedTextField();
                EcEditorUtil.setFormattedTextField(txtNumber, scale);
                KDTDefaultCellEditor numberEditor = new KDTDefaultCellEditor(txtNumber);
                numberEditor.setClickCountToStart(1);
                String colFormat = EcRenderUtil.getDecimalFormat2(scale);
                IRow row = null;
                int i = 0;
                do
                {
                    try
                    {
                        row = footManager.getFootRow(i);
                    }
                    catch(Exception e)
                    {
                        break;
                    }
                    if(null == row)
                        break;
                    ICell cell = row.getCell(columnName);
                    if(null != cell)
                    {
                        cell.setEditor(numberEditor);
                        cell.getStyleAttributes().setNumberFormat(colFormat);
                        setScale(row, columnName, scale);
                        BigDecimal value = EcHelper.toBigDecimal(cell.getValue());
                        cell.setValue(value);
                    }
                    i++;
                } while(true);
            }
        }
    }

    public static void formatCellNumber2(IRow row, String columnNames[], int scale)
    {
        if(EcArrayUtil.isNotEmpty(columnNames))
        {
            int length = columnNames.length;
            String columnName = null;
            for(int i = 0; i < length; i++)
            {
                columnName = columnNames[i];
                formatCellNumber2(row, columnName, scale);
            }

        }
    }

    public static void formatCellNumber2(IRow row, List columnNameList, int scale)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            formatCellNumber2(row, columnNames, scale);
        }
    }

    public static void formatCellNumber2(IRow row, String columnName, int scale)
    {
        ICell cell = row.getCell(columnName);
        if(null != cell)
        {
            StyleAttributes sa = cell.getStyleAttributes();
            String strDataFormat = EcRenderUtil.getDecimalFormat2(scale);
            sa.setNumberFormat(strDataFormat);
            sa.setHorizontalAlign(com.kingdee.bos.ctrl.kdf.util.style.Styles.HorizontalAlignment.RIGHT);
        }
    }

    public static void setRender(KDTable table, String columnName, EcBaseRender render)
    {
        IColumn column = table.getColumn(columnName);
        if(column != null)
            column.setRenderer(render);
    }

    public static void setRender(KDTable table, String columnNames[], EcBaseRender renders[])
    {
        int i = 0;
        for(int count = columnNames.length; i < count; i++)
            setRender(table, columnNames[i], renders[i]);

    }

    public static void setRender(KDTable table, List columnNameList, EcBaseRender render[])
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            setRender(table, columnNames, render);
        }
    }

    public static void setRender(KDTable table, String columnNames[], EcBaseRender render)
    {
        int i = 0;
        for(int count = columnNames.length; i < count; i++)
            setRender(table, columnNames[i], render);

    }

    public static void setRender(KDTable table, List columnNameList, EcBaseRender render)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            setRender(table, columnNames, render);
        }
    }

    public static void deleteLine(CoreUIObject ui, KDTable tblEntry)
    {
        if(tblEntry.getSelectManager().size() == 0)
        {
            MsgBox.showInfo(ui, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));
            return;
        }
        if(MsgBox.isYes(MsgBox.showConfirm2(ui, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Confirm_Delete"))))
        {
            KDTSelectManager selectManager = tblEntry.getSelectManager();
            int size = selectManager.size();
            if(size <= 0)
                return;
            KDTSelectBlock selectBlock = null;
            Set indexSet = new HashSet();
            for(int blockIndex = size - 1; blockIndex >= 0; blockIndex--)
            {
                selectBlock = selectManager.get(blockIndex);
                int top = selectBlock.getBeginRow();
                int bottom = selectBlock.getEndRow();
                for(int delIndex = bottom; delIndex >= top; delIndex--)
                    indexSet.add(new Integer(delIndex));

            }

            Integer indexArr[] = new Integer[indexSet.size()];
            Object indexObj[] = indexSet.toArray();
            System.arraycopy(((Object) (indexObj)), 0, indexArr, 0, indexArr.length);
            Arrays.sort(indexArr);
            if(indexArr == null || indexArr.length == 0)
                return;
            for(int i = indexArr.length - 1; i >= 0; i--)
            {
                int rowIndex = Integer.parseInt(String.valueOf(indexArr[i]));
                IObjectValue detailData = (IObjectValue)tblEntry.getRow(rowIndex).getUserObject();
                tblEntry.removeRow(rowIndex);
                IObjectCollection collection = (IObjectCollection)tblEntry.getUserObject();
                if(collection == null || detailData == null)
                    continue;
                int index = getCollectionIndex(collection, detailData);
                if(index >= 0 && collection.size() > index)
                    collection.removeObject(index);
            }

        }
        if(tblEntry.getRow(0) != null)
            tblEntry.getSelectManager().select(0, 0);
    }

    public static int getCollectionIndex(IObjectCollection collection, IObjectValue obj)
    {
        int index = -1;
        if(collection == null)
            return index;
        for(int i = collection.size() - 1; i >= 0; i--)
            if(obj == collection.getObject(i))
            {
                index = i;
                return index;
            }

        return index;
    }

    public static void addPopMenu(CoreUI ui, KDTable tblMain, ItemAction action[])
    {
        KDPopupMenu kdmenu = new KDPopupMenu();
        for(int i = 0; i < action.length; i++)
        {
            JMenuItem item = new JMenuItem();
            item.setAction(action[i]);
            kdmenu.add(item);
            item.setEnabled(action[i].isEnabled());
        }

        kdmenu.add(new KDSeparator());
        KDPopupMenu menu = ui.getMenuManager(tblMain).getMenu();
        int count = menu.getComponentCount();
        for(int i = 0; i < count; i++)
            kdmenu.add(menu.getComponent(0));

        ui.getMenuManager(tblMain).setMenu(kdmenu);
    }

    public static void setSelect(CoreUI ui, KDTable tblMain, String cloumnKey, boolean selected)
    {
        KDTSelectManager selectManager = tblMain.getSelectManager();
        int size = selectManager.size();
        if(size <= 0)
            return;
        KDTSelectBlock selectBlock = null;
        for(int blockIndex = size - 1; blockIndex >= 0; blockIndex--)
        {
            selectBlock = selectManager.get(blockIndex);
            int top = selectBlock.getBeginRow();
            int bottom = selectBlock.getEndRow();
            for(int delIndex = bottom; delIndex >= top; delIndex--)
            {
                IRow rowAss = tblMain.getRow(delIndex);
                rowAss.getCell(cloumnKey).setValue(Boolean.valueOf(selected));
            }

        }

    }

    public static void removeRows(KDTable tables[])
    {
        Set tableSet = new HashSet(Arrays.asList(tables));
        KDTable table = null;
        for(Iterator iterator = tableSet.iterator(); iterator.hasNext(); removeRows(table))
            table = (KDTable)iterator.next();

    }

    public static void removeRows(KDTable table)
    {
        if(null != table)
            table.removeRows();
    }

    public static void clearColumns(KDTable table, String columNames[], boolean isClearFoot)
    {
        int rowCount = table.getRowCount();
        IRow row = null;
        IRow footRow = null;
        int length = columNames.length;
        String columName = null;
        for(int i = 0; i < rowCount; i++)
        {
            row = table.getRow(i);
            for(int j = 0; j < length; j++)
            {
                columName = columNames[j];
                row.getCell(columName).setValue(null);
            }

        }

        if(isClearFoot)
        {
            footRow = table.getFootManager().getFootRow(0);
            for(int j = 0; j < length; j++)
            {
                columName = columNames[j];
                footRow.getCell(columName).setValue(null);
            }

        }
    }

    public static void clearColumns(Map tableMap, boolean isClearFoot)
    {
        Set set = tableMap.keySet();
        KDTable table = null;
        String columNames[] = null;
        for(Iterator iterator = set.iterator(); iterator.hasNext(); clearColumns(table, columNames, isClearFoot))
        {
            table = (KDTable)iterator.next();
            columNames = (String[])(String[])tableMap.get(table);
        }

    }

    public static String[] getColumnKeys(KDTable table)
    {
        String columNames[] = null;
        int columnCount = table.getColumnCount();
        columNames = new String[columnCount];
        for(int i = 0; i < columnCount; i++)
            columNames[i] = table.getColumnKey(i);

        return columNames;
    }

    public static String[] getColumnKeysOfRequired(KDTable table, boolean required)
    {
        String columnKeys[] = null;
        int columnCount = table.getColumnCount();
        List columnKeyList = new ArrayList();
        IColumn column = null;
        for(int i = 0; i < columnCount; i++)
        {
            column = table.getColumn(i);
            if(column.isRequired() == required)
                columnKeyList.add(column.getKey());
        }

        columnKeys = (String[])(String[])columnKeyList.toArray(new String[0]);
        return columnKeys;
    }

    public static String[] getColumnKeysOfHided(KDTable table, boolean isHided)
    {
        String columnKeys[] = null;
        int columnCount = table.getColumnCount();
        List columnKeyList = new ArrayList();
        IColumn column = null;
        for(int i = 0; i < columnCount; i++)
        {
            column = table.getColumn(i);
            if(column.getStyleAttributes().isHided() == isHided)
                columnKeyList.add(column.getKey());
        }

        columnKeys = (String[])(String[])columnKeyList.toArray(new String[0]);
        return columnKeys;
    }

    public static String[] getColumnKeysOfRequiredHided(KDTable table, boolean required, boolean isHided)
    {
        String columnKeys[] = null;
        int columnCount = table.getColumnCount();
        List columnKeyList = new ArrayList();
        IColumn column = null;
        for(int i = 0; i < columnCount; i++)
        {
            column = table.getColumn(i);
            if(column.isRequired() == required && column.getStyleAttributes().isHided() == isHided)
                columnKeyList.add(column.getKey());
        }

        columnKeys = (String[])(String[])columnKeyList.toArray(new String[0]);
        return columnKeys;
    }

    public static boolean isEmpty(KDTable table)
    {
        return null == table || 0 == table.getRowCount();
    }

    public static boolean isNotEmpty(KDTable table)
    {
        return !isEmpty(table);
    }

    public static void setScale(IRow row, String keys[], int scale)
    {
        int i = 0;
        for(int len = keys.length; i < len; i++)
            setScale(row, keys[i], scale);

    }

    public static void setScale(IRow row, String key, int scale)
    {
        ICell cell = row.getCell(key);
        if(null != cell)
        {
            BigDecimal value = EcHelper.toBigDecimal(cell.getValue());
            if(null != value)
            {
                value = value.setScale(scale, 4);
                cell.setValue(value);
            }
        }
    }

    public static Map getCellMap(KDTable table, String columNames[], int startRowIndex, int endRowIndex)
    {
        Map cellMap = new LinkedHashMap();
        int rowCount = table.getRowCount();
        if(startRowIndex <= endRowIndex && startRowIndex < rowCount)
        {
            int mixRowIndex = 0 <= startRowIndex ? startRowIndex : 0;
            int maxRowIndex = rowCount - 1 <= endRowIndex ? endRowIndex : rowCount - 1;
            int length = columNames.length;
            String columName = null;
            ICell cell = null;
            List cellList = null;
label0:
            for(int i = 0; i < length; i++)
            {
                columName = columNames[i];
                cellList = (List)cellMap.get(columName);
                if(null == cellList)
                {
                    cellList = new ArrayList();
                    cellMap.put(columName, cellList);
                }
                int j = mixRowIndex;
                do
                {
                    if(j >= maxRowIndex)
                        continue label0;
                    cell = table.getCell(j, columName);
                    if(null == cell)
                        continue label0;
                    cellList.add(cell);
                    j++;
                } while(true);
            }

        }
        return cellMap;
    }

    public static Map getCellMap(KDTable table, String columNames[])
    {
        return getCellMap(table, columNames, 0, table.getRowCount() - 1);
    }

    public static List getCellList(KDTable table, String columName, int startRowIndex, int endRowIndex)
    {
        Map cellMap = getCellMap(table, new String[] {
            columName
        }, startRowIndex, endRowIndex);
        return (List)cellMap.get(columName);
    }

    public static List getCellList(KDTable table, String columName)
    {
        return getCellList(table, columName, 0, table.getRowCount());
    }

    public static Map getCellValueMap(KDTable table, String columNames[], int startRowIndex, int endRowIndex)
    {
        Map cellValueMap = new LinkedHashMap();
        int rowCount = table.getRowCount();
        if(startRowIndex <= endRowIndex && startRowIndex < rowCount)
        {
            int mixRowIndex = 0 <= startRowIndex ? startRowIndex : 0;
            int maxRowIndex = rowCount - 1 <= endRowIndex ? endRowIndex : rowCount - 1;
            int length = columNames.length;
            String columName = null;
            ICell cell = null;
            Object cellValue = null;
            List cellValueList = null;
label0:
            for(int i = 0; i < length; i++)
            {
                columName = columNames[i];
                cellValueList = (List)cellValueMap.get(columName);
                if(null == cellValueList)
                {
                    cellValueList = new ArrayList();
                    cellValueMap.put(columName, cellValueList);
                }
                int j = mixRowIndex;
                do
                {
                    if(j >= maxRowIndex)
                        continue label0;
                    cell = table.getCell(j, columName);
                    if(null == cell)
                        continue label0;
                    cellValue = cell.getValue();
                    cellValueList.add(cellValue);
                    j++;
                } while(true);
            }

        }
        return cellValueMap;
    }

    public static Map getCellValueMap(KDTable table, String columNames[])
    {
        return getCellValueMap(table, columNames, 0, table.getRowCount() - 1);
    }

    public static List getCellValueList(KDTable table, String columName, int startRowIndex, int endRowIndex)
    {
        Map cellValueMap = getCellValueMap(table, new String[] {
            columName
        }, startRowIndex, endRowIndex);
        return (List)cellValueMap.get(columName);
    }

    public static List getCellValueList(KDTable table, String columName)
    {
        return getCellValueList(table, columName, 0, table.getRowCount());
    }

    public static Object getCellValue(KDTable table, String columName, int rowIndex)
    {
        Object value = null;
        List list = getCellValueList(table, columName, rowIndex, rowIndex);
        if(EcCollectionUtil.isNotEmpty(list))
            value = list.get(0);
        return value;
    }

    public static Map getOtherCellMap(KDTable table, String columNames[], int startRowIndex, int endRowIndex, IRow row)
    {
        Map cellMap = new LinkedHashMap();
        int rowCount = table.getRowCount();
        if(startRowIndex <= endRowIndex && startRowIndex < rowCount)
        {
            int mixRowIndex = 0 <= startRowIndex ? startRowIndex : 0;
            int maxRowIndex = rowCount - 1 <= endRowIndex ? endRowIndex : rowCount - 1;
            int rowIndex = row.getRowIndex();
            int length = columNames.length;
            String columName = null;
            ICell cell = null;
            List cellList = null;
            for(int i = 0; i < length; i++)
            {
                columName = columNames[i];
                cellList = (List)cellMap.get(columName);
                if(null == cellList)
                {
                    cellList = new ArrayList();
                    cellMap.put(columName, cellList);
                }
                for(int j = mixRowIndex; j < maxRowIndex; j++)
                {
                    if(j == rowIndex)
                        continue;
                    cell = table.getCell(j, columName);
                    if(null == cell)
                        break;
                    cellList.add(cell);
                }

            }

        }
        return cellMap;
    }

    public static Map getOtherCellMap(KDTable table, String columNames[], IRow row)
    {
        return getOtherCellMap(table, columNames, 0, table.getRowCount() - 1, row);
    }

    public static List getOtherCellList(KDTable table, String columName, int startRowIndex, int endRowIndex, IRow row)
    {
        Map cellMap = getOtherCellMap(table, new String[] {
            columName
        }, startRowIndex, endRowIndex, row);
        return (List)cellMap.get(columName);
    }

    public static List getOtherCellList(KDTable table, String columName, IRow row)
    {
        return getOtherCellList(table, columName, 0, table.getRowCount(), row);
    }

    public static Map getOtherCellValueMap(KDTable table, String columNames[], int startRowIndex, int endRowIndex, IRow row)
    {
        Map cellValueMap = new LinkedHashMap();
        int rowCount = table.getRowCount();
        if(startRowIndex <= endRowIndex && startRowIndex < rowCount)
        {
            int mixRowIndex = 0 <= startRowIndex ? startRowIndex : 0;
            int maxRowIndex = rowCount - 1 <= endRowIndex ? endRowIndex : rowCount - 1;
            int rowIndex = row.getRowIndex();
            int length = columNames.length;
            String columName = null;
            ICell cell = null;
            Object cellValue = null;
            List cellValueList = null;
            for(int i = 0; i < length; i++)
            {
                columName = columNames[i];
                cellValueList = (List)cellValueMap.get(columName);
                if(null == cellValueList)
                {
                    cellValueList = new ArrayList();
                    cellValueMap.put(columName, cellValueList);
                }
                for(int j = mixRowIndex; j < maxRowIndex; j++)
                {
                    if(j == rowIndex)
                        continue;
                    cell = table.getCell(j, columName);
                    if(null == cell)
                        break;
                    cellValue = cell.getValue();
                    cellValueList.add(cellValue);
                }

            }

        }
        return cellValueMap;
    }

    public static Map getOtherCellValueMap(KDTable table, String columNames[], IRow row)
    {
        return getOtherCellValueMap(table, columNames, 0, table.getRowCount() - 1, row);
    }

    public static List getOtherCellValueList(KDTable table, String columName, int startRowIndex, int endRowIndex, IRow row)
    {
        Map cellValueMap = getOtherCellValueMap(table, new String[] {
            columName
        }, startRowIndex, endRowIndex, row);
        return (List)cellValueMap.get(columName);
    }

    public static List getOtherCellValueList(KDTable table, String columName, IRow row)
    {
        return getOtherCellValueList(table, columName, 0, table.getRowCount(), row);
    }

    public static boolean containsCell(KDTable table, String columName, ICell cell, int startRowIndex, int endRowIndex)
    {
        boolean flag = false;
        List cellList = getCellList(table, columName, startRowIndex, endRowIndex);
        if(EcCollectionUtil.isNotEmpty(cellList) && cellList.contains(cell))
            flag = true;
        return flag;
    }

    public static boolean containsCell(KDTable table, String columName, ICell cell)
    {
        return containsCell(table, columName, cell, 0, table.getRowCount());
    }

    public static boolean containsCellValue(KDTable table, String columName, Object value, int startRowIndex, int endRowIndex)
    {
        boolean flag = false;
        List cellValueList = getCellValueList(table, columName, startRowIndex, endRowIndex);
        if(EcCollectionUtil.isNotEmpty(cellValueList) && cellValueList.contains(value))
            flag = true;
        return flag;
    }

    public static boolean containsCellValue(KDTable table, String columName, Object value)
    {
        return containsCellValue(table, columName, value, 0, table.getRowCount());
    }

    public static String getHeadName(KDTable table, String key)
    {
        String headName = "";
        IRow headRow = null;
        ICell headCell = null;
        int i = 0;
        for(int rowCount = table.getHeadRowCount(); i < rowCount; i++)
        {
            if(!"".equals(headName))
                headName = (new StringBuilder()).append(headName).append("-").toString();
            headRow = table.getHeadRow(i);
            headCell = headRow.getCell(key);
            headName = (new StringBuilder()).append(headName).append((String)headCell.getValue()).toString();
        }

        return headName;
    }

    public static Object getSelectCellValue(java.awt.Component comp, KDTable table, String key)
    {
        Object value = null;
        EcClientVerifyHelper.checkSelected(comp, table);
        IRow row = KDTableUtil.getSelectedRow(table);
        value = getSelectCellValue(comp, row, key);
        return value;
    }

    public static Object getSelectCellValue(java.awt.Component comp, IRow row, String key)
    {
        Object value = null;
        ICell cell = row.getCell(key);
        if(null != cell)
            value = cell.getValue();
        return value;
    }

    public static Object getOnlySelectCellValue(java.awt.Component comp, KDTable table)
    {
        Object value = null;
        EcClientVerifyHelper.checkSelected(comp, table);
        List blocks = table.getSelectManager().getBlocks();
        int left = -1;
        int top = -1;
        int bottom = -1;
        if(blocks.size() > 1)
        {
            MsgBox.showWarning(comp, "\u53EA\u80FD\u9009\u62E9\u4E00\u884C");
            SysUtil.abort();
        }
        KDTSelectBlock block = (KDTSelectBlock)blocks.get(0);
        top = block.getTop();
        bottom = block.getBottom();
        if(top != bottom)
        {
            MsgBox.showWarning(comp, "\u53EA\u80FD\u9009\u62E9\u4E00\u884C");
            SysUtil.abort();
        }
        if(block.getLeft() != block.getRight())
        {
            MsgBox.showWarning(comp, "\u53EA\u80FD\u9009\u62E9\u4E00\u5217");
            SysUtil.abort();
        }
        if(-1 == left)
            left = block.getLeft();
        else
        if(block.getLeft() == left)
        {
            MsgBox.showWarning(comp, "\u53EA\u80FD\u9009\u62E9\u4E00\u5217");
            SysUtil.abort();
        }
        ICell cell = table.getRow(top).getCell(left);
        value = cell.getValue();
        return value;
    }

    public static boolean setColumnValue(KDTable table, String key, Object value)
    {
        boolean flag = false;
        IRow row = null;
        ICell cell = null;
        int i = 0;
        for(int rowCount = table.getRowCount(); i < rowCount; i++)
        {
            row = table.getRow(i);
            cell = row.getCell(key);
            if(null != cell)
                cell.setValue(value);
        }

        return flag;
    }

    public static boolean setCellValue(IRow row, String key, Object value)
    {
        boolean flag = false;
        ICell cell = row.getCell(key);
        if(null != cell)
            cell.setValue(value);
        return flag;
    }

    public static IRow appendFootRow(KDTable tblMain, String columnNameArr[])
    {
        IRow row = null;
        if(EcArrayUtil.isNotEmpty(columnNameArr))
            row = TableHelper.appendFootRow(tblMain, columnNameArr);
        return row;
    }

    public static IRow appendFootRow(KDTable tblMain, List columnNameList)
    {
        IRow row = null;
        row = TableHelper.appendFootRow(tblMain, columnNameList);
        return row;
    }

    public static void sumTable(KDTable table, String columnNames[])
    {
        if(EcArrayUtil.isNotEmpty(columnNames))
        {
            int length = columnNames.length;
            IRow row = null;
            String columnName = null;
            KDTFootManager footManager = table.getFootManager();
            if(null != footManager)
            {
                row = footManager.getFootRow(0);
                if(null == row)
                    return;
                for(int i = 0; i < length; i++)
                {
                    columnName = columnNames[i];
                    TableHelper.setFieldValue(row, columnName, null);
                }

                Map mapSum = TableHelper.sumTable(table, columnNames);
                Set setKey = mapSum.keySet();
                String str;
                for(Iterator iter = setKey.iterator(); iter.hasNext(); TableHelper.setFieldValue(row, str, mapSum.get(str)))
                    str = (String)iter.next();

            }
        }
    }

    public static void sumTable(KDTable table, List columnNameList)
    {
        if(EcCollectionUtil.isNotEmpty(columnNameList))
        {
            EcCollectionUtil.clearDuplicateAndNull(columnNameList);
            String columnNames[] = (String[])(String[])columnNameList.toArray(new String[0]);
            sumTable(table, columnNames);
        }
    }

    public static void initUserProperties(KDTable table)
    {
        table.putUserProperty("INIT_USERPROPERTIES", Boolean.TRUE);
    }

    public static void putUserProperty(KDTable table, String key, Object value)
    {
        initUserProperties(table);
        table.putUserProperty(key, value);
    }

    public static Object getUserProperty(KDTable table, String key)
    {
        Object value = null;
        initUserProperties(table);
        value = table.getUserProperty(key);
        return value;
    }

    public static Object getUserProperty(KDTable table, String key, Object defaultValue)
    {
        Object value = null;
        value = getUserProperty(table, key);
        value = EcObjectUtil.defaultIfNull(value, defaultValue);
        return value;
    }

    public static void setRemoveingZeroInDispaly(KDTable table)
    {
        putUserProperty(table, "USERPROPERTYS_IS_REMOVEING_ZERO_IN_DISPALY", Boolean.TRUE);
    }

    public static boolean isRemoveingZeroInDispaly(KDTable table)
    {
        Boolean value = (Boolean)getUserProperty(table, "USERPROPERTYS_IS_REMOVEING_ZERO_IN_DISPALY", Boolean.FALSE);
        return value.booleanValue();
    }

    public static Map getColumnKeyNameMap(KDTable table)
    {
        Map columnKeyNameMap = new LinkedHashMap();
        String columnKeys[] = getColumnKeys(table);
        for(int i = 0; i < columnKeys.length; i++)
        {
            String key = columnKeys[i];
            String value = getHeadName(table, key);
            columnKeyNameMap.put(key, value);
        }

        return columnKeyNameMap;
    }

    public static void debugPrintColumnKeyNameMap(KDTable table)
    {
        Map columnKeyNameMap = getColumnKeyNameMap(table);
        System.out.println("-----------------------------------------------");
        MapUtils.debugPrint(System.out, "columnKeyNameMap", columnKeyNameMap);
        System.out.println("-----------------------------------------------");
    }

    public static Map getColumnKeyIndexMap(KDTable table)
    {
        Map columnKeyIndexMap = new LinkedHashMap();
        int columnCount = table.getColumnCount();
        for(int i = 0; i < columnCount; i++)
        {
            String key = table.getColumnKey(i);
            Integer value = Integer.valueOf(i);
            columnKeyIndexMap.put(key, value);
        }

        return columnKeyIndexMap;
    }

    public static void debugPrintColumnKeyIndexMap(KDTable table)
    {
        Map columnKeyIndexMap = getColumnKeyIndexMap(table);
        System.out.println("-----------------------------------------------");
        MapUtils.debugPrint(System.out, "columnKeyIndexMap", columnKeyIndexMap);
        System.out.println("-----------------------------------------------");
    }

    public static void generateColumnKeyFiledDefCode(KDTable table, String prefix)
    {
        System.out.println("\t// ////////////////////////////////////////////////////////////////");
        System.out.println("\t// ////////////////////////////////////////////////////////////////");
        System.out.println();
        String codeTpl = "\tprotected static final String {filedName} = \"{filedValue}\";";
        String filedName = null;
        String filedValue = null;
        String code = null;
        String key = null;
        String strArr[] = null;
        String columnKeys[] = getColumnKeys(table);
        if(EcStringUtil.isBlank(prefix))
            prefix = "COL_";
        else
            prefix = (new StringBuilder()).append("COL_").append(prefix).append("_").toString();
        for(int i = 0; i < columnKeys.length; i++)
        {
            key = columnKeys[i];
            strArr = EcStringUtil.splitByCharacterTypeCamelCase(key);
            filedName = EcArrayUtil.toString(strArr, "", "", "_");
            filedName = filedName.replaceAll("\\_\\.\\_", "_");
            filedName = filedName.replaceAll("\\.", "_");
            filedName = filedName.replaceAll("\\_\\_", "_");
            filedName = filedName.replaceAll("\\_\\_\\_", "_");
            filedName = (new StringBuilder()).append(prefix).append(filedName).toString();
            filedName = filedName.toUpperCase();
            filedValue = key;
            code = codeTpl;
            code = code.replaceFirst("\\{filedName\\}", filedName);
            code = code.replaceFirst("\\{filedValue\\}", filedValue);
            System.out.println(code);
        }

        System.out.println("\t// ////////////////////////////////////////////////////////////////");
        System.out.println("\t// ////////////////////////////////////////////////////////////////");
        System.out.println();
    }

    public static void generateColumnKeyFiledDefCode(KDTable table)
    {
        generateColumnKeyFiledDefCode(table, null);
    }

    public static void sumParentNumber(KDTable table, String columnNameArr[])
    {
        sumParentNumber(table, columnNameArr, null);
    }

    public static void sumParentNumber(KDTable table, String columnNameArr[], String subNumberColumnName)
    {
        boolean hasSubNumber = EcStringUtil.isNotBlank(subNumberColumnName);
        if(isEmpty(table) || EcArrayUtil.isEmpty(columnNameArr))
            return;
        int rowCount = table.getRowCount();
        int length = columnNameArr.length;
        IRow curRow = null;
        String curId = null;
        String curLongNumber = null;
        String curName = null;
        Boolean curIsLeaf = null;
        String curParentId = null;
        String subNumber = null;
        Map numMap = null;
        String columnName = null;
        BigDecimal columnValue = null;
        Map totalNumSumMap = new LinkedHashMap();
        Map totalNumMap = null;
        BigDecimal totalAmountSum = null;
        BigDecimal totalAmount = null;
        IRow row = null;
        String parentId = null;
        BigDecimal parentOldValue = null;
        BigDecimal curValue = null;
        BigDecimal parentNewValue = null;
        for(int curRowIndex = 0; curRowIndex < rowCount; curRowIndex++)
        {
            curRow = table.getRow(curRowIndex);
            curId = (String)curRow.getCell("id").getValue();
            curIsLeaf = EcObjectUtil.toBoolean(curRow.getCell("isLeaf").getValue());
            curParentId = (String)curRow.getCell("parent.id").getValue();
            if(!Boolean.TRUE.equals(curIsLeaf) || null == curParentId)
                continue;
            numMap = new LinkedHashMap();
            for(int k = 0; k < length; k++)
            {
                columnName = columnNameArr[k];
                columnValue = EcNumberHelper.toBigDecimal(curRow.getCell(columnName).getValue());
                numMap.put(columnName, columnValue);
                if(!hasSubNumber)
                    continue;
                totalAmountSum = EcConstant.ZERO;
                totalNumMap = (Map)totalNumSumMap.get(columnName);
                if(null == totalNumMap)
                {
                    totalNumMap = new LinkedHashMap();
                    totalNumSumMap.put(columnName, totalNumMap);
                }
                if(totalNumMap.containsKey(curId))
                    totalAmountSum = (BigDecimal)totalNumMap.get(curId);
                totalAmount = columnValue;
                totalAmountSum = EcHelper.add(totalAmountSum, totalAmount);
                totalNumMap.put(curId, totalAmountSum);
            }

            for(int i = curRowIndex - 1; i >= 0; i--)
            {
                row = table.getRow(i);
                parentId = row.getCell("id").getValue().toString();
                if(!parentId.equals(curParentId))
                    continue;
                for(int k = 0; k < length; k++)
                {
                    columnName = columnNameArr[k];
                    parentOldValue = EcNumberHelper.toBigDecimal(row.getCell(columnName).getValue());
                    curValue = (BigDecimal)numMap.get(columnName);
                    parentNewValue = EcNumberHelper.add(parentOldValue, curValue);
                    row.getCell(columnName).setValue(parentNewValue);
                }

                if(row.getCell("parent.id").getValue() != null)
                    curParentId = table.getRow(i).getCell("parent.id").getValue().toString();
            }

        }

        if(hasSubNumber)
        {
            for(int curRowIndex = 0; curRowIndex < rowCount; curRowIndex++)
            {
                curRow = table.getRow(curRowIndex);
                curId = (String)curRow.getCell("id").getValue();
                curLongNumber = (String)curRow.getCell("longNumber").getValue();
                curName = (String)curRow.getCell("name").getValue();
                subNumber = (String)curRow.getCell(subNumberColumnName).getValue();
                curIsLeaf = EcObjectUtil.toBoolean(curRow.getCell("isLeaf").getValue());
                if(!Boolean.TRUE.equals(curIsLeaf) || null != subNumber)
                    continue;
                for(int k = 0; k < length; k++)
                {
                    columnName = columnNameArr[k];
                    totalNumMap = (Map)totalNumSumMap.get(columnName);
                    if(null != totalNumMap)
                    {
                        totalAmountSum = (BigDecimal)totalNumMap.get(curId);
                        curRow.getCell(columnName).setValue(totalAmountSum);
                        System.out.println((new StringBuilder()).append("longNumber:").append(curLongNumber).append("\uFF0Cname:").append(curName).append("\uFF0CcolumnName:").append(columnName).append("\uFF0CtotalAmountSum:").append(totalAmountSum).toString());
                    }
                }

            }

        }
    }

    public static void manyRowBatchSetValues(KDTable table, String key, Object newValue)
    {
        KDTSelectManager selectManager = table.getSelectManager();
        int size = selectManager.size();
        KDTSelectBlock selectBlock = null;
        for(int blockIndex = 0; blockIndex < size; blockIndex++)
        {
            selectBlock = selectManager.get(blockIndex);
            int top = selectBlock.getBeginRow();
            int bottom = selectBlock.getEndRow();
            if(table.getRow(top) == null)
            {
                MsgBox.showInfo(EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));
                return;
            }
            for(int i = top; i <= bottom; i++)
                table.getRow(i).getCell(key).setValue(newValue);

            int activeRow = table.getSelectManager().getActiveRowIndex();
            table.getRow(activeRow).getCell(key).setValue(newValue);
        }

    }

    public static void manyRowBatchSetValues(KDTable table, Map param, int activeRow)
    {
        KDTSelectManager selectManager = table.getSelectManager();
        int size = selectManager.size();
        KDTSelectBlock selectBlock = null;
        Set keySet = param.keySet();
        for(Iterator iterator = keySet.iterator(); iterator.hasNext();)
        {
            String key = (String)iterator.next();
            Object newValue = param.get(key);
            int blockIndex = 0;
            while(blockIndex < size) 
            {
                selectBlock = selectManager.get(blockIndex);
                int top = selectBlock.getBeginRow();
                int bottom = selectBlock.getEndRow();
                if(table.getRow(top) == null)
                {
                    MsgBox.showInfo(EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));
                    return;
                }
                for(int i = top; i <= bottom; i++)
                    table.getRow(i).getCell(key).setValue(newValue);

                table.getRow(activeRow).getCell(key).setValue(newValue);
                blockIndex++;
            }
        }

    }

    public static LinkedList BatchSetValues(KDTable table, String key, Object newValue)
    {
        KDTSelectManager selectManager = table.getSelectManager();
        int size = selectManager.size();
        KDTSelectBlock selectBlock = null;
        LinkedList list = new LinkedList();
        for(int blockIndex = 0; blockIndex < size; blockIndex++)
        {
            selectBlock = selectManager.get(blockIndex);
            int top = selectBlock.getBeginRow();
            int bottom = selectBlock.getEndRow();
            if(table.getRow(top) == null)
            {
                MsgBox.showInfo(EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));
                return null;
            }
            for(int i = top; i <= bottom; i++)
            {
                table.getRow(i).getCell(key).setValue(newValue);
                list.add(table.getRow(i));
            }

            int activeRow = table.getSelectManager().getActiveRowIndex();
            table.getRow(activeRow).getCell(key).setValue(newValue);
            list.add(table.getRow(activeRow));
        }

        return list;
    }

    public static void removeEmptyRow(KDTable table)
    {
        boolean isNotEmpty = false;
        for(int i = table.getRowCount() - 1; i >= 0; i--)
        {
            for(int j = 0; j < table.getColumnCount(); j++)
                if(!EcHelper.isEmpty(table.getRow(i).getCell(j).getValue()))
                    isNotEmpty = true;

            if(!isNotEmpty)
                table.removeRow(i);
            isNotEmpty = false;
        }

    }

    public static List getSelectedRowIndexs(KDTable table)
    {
        KDTSelectManager selectManager = table.getSelectManager();
        int size = selectManager.size();
        KDTSelectBlock selectBlock = null;
        List list = new ArrayList();
        for(int blockIndex = 0; blockIndex < size; blockIndex++)
        {
            selectBlock = selectManager.get(blockIndex);
            int top = selectBlock.getBeginRow();
            int bottom = selectBlock.getEndRow();
            if(table.getRow(top) == null)
            {
                MsgBox.showInfo(EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));
                return null;
            }
            for(int i = top; i <= bottom; i++)
                list.add(Integer.valueOf(i));

            int activeRow = table.getSelectManager().getActiveRowIndex();
            list.add(Integer.valueOf(activeRow));
        }

        return list;
    }

    public static void tableSort(KDTable tbl)
    {
        for(int i = 0; i < tbl.getColumnCount(); i++)
            tbl.getColumn(i).setSortable(true);

        KDTSortManager sortManager = new KDTSortManager(tbl);
        sortManager.setClickCount(1);
        sortManager.setSortAuto(true);
    }
}


/*
	DECOMPILATION REPORT

	Decompiled from: F:\qs\lib\client\industry\ec_common-client.jar
	Total time: 31 ms
	Jad reported messages/errors:
	Exit status: 0
	Caught exceptions:
*/